package com.ps.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ps.dao.IItemDao;
import com.ps.service.IItemService;
import com.ps.vo.Item;
import com.ps.vo.PageUtil;
@Service
public class ItemServiceImpl implements IItemService {

	@Autowired
	IItemDao itemDao;
	
	@Override
	public PageUtil<Item> queryItemList(PageUtil<Item> pageUtil) {
		Map<String,Object> map=new HashMap<String,Object>();
		map.put("start", pageUtil.getStart());
		map.put("size", pageUtil.getPageSize());
		
		List<Item> list=itemDao.queryItemList(map);
		int total=itemDao.queryItemTotal();
		
		pageUtil.setRows(list);
		pageUtil.setTotal(total);
		return pageUtil;
	}

	@Override
	public void deleteItemById(int id) {
		itemDao.deleteItembyId(id);
	}

}
